﻿using Grain.State.StateEntitys;
using iTool.ClusterComponent;
using System.Threading.Tasks;

namespace Grain.Interfaces
{
    /// <summary>
    /// 每个云函数的编辑状态
    /// </summary>
    public interface IEditCloudFunctionService : iToolServiceWithStringKey
    {
        /// <summary>
        /// 编辑状态
        /// </summary>
        /// <param name="script"></param>
        /// <returns></returns>
        Task Edit(string script, string channel);

        /// <summary>
        /// 退出编辑状态
        /// </summary>
        /// <returns></returns>
        Task ExitEditState(string script);

        /// <summary>
        /// 修改指定Function信息
        /// </summary>
        /// <param name="moduleName"></param>
        /// <returns></returns>
        Task Modify(string script);

        /// <summary>
        /// 删除指定Function
        /// </summary>
        /// <param name="moduleName"></param>
        /// <returns></returns>
        Task Remove();

        /// <summary>
        /// 获取云函数信息
        /// </summary>
        /// <returns></returns>
        Task<EditCloudFunctionState> GetDetail();
    }
}
